<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <include file="./Application/Home/View/Send/head.html" />
</head>
<body>
<!--菜单栏开始，小屏幕不可见-->
<div id="menu">
    <div class="col-sm-3 col-md-2 sidebar">
        <ul class="nav nav-sidebar">
            <li ><a href="<{:U('Home/Send/basic')}>">基础信息</a></li>
            <li ><a href="<{:U('Home/Send/all')}>" >全局数据</a></li>
            <li class="active"><a href="<{:U('Home/Send/data')}>">资料管理</a></li>
            <li><a href="<{:U('Home/Send/verdict')}>">定案表管理</a></li>
        </ul>
    </div>
</div>
<!--菜单栏结束-->
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <div style="float:right;">
                <div class="btn-group" role="group" aria-label="...">
                    <form style="display:inline-block" action="<{:U('send/exportExcel')}>" method="POST" target="_blank">
                        <input type="hidden" name="type" value="data" />
                        <button href="" class="btn btn-default">导出资料管理数据</button>
                    </form>
                </div>
            </div>
            <h2 class="sub-header" style="display: inline-block; margin-top: 0">资料管理 <{$currentBatch}>
                <div class="btn-group" role="group">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        选择送审批次
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="<{:U('send/data')}>">所有批次</a></li>
                        <volist name="batchList" id="batch">
                            <li><a href="<{:U('send/data', ['batch' => $batch])}>"><{$batch}></a></li>
                        </volist>
                    </ul>
                </div>
            </h2>
            <div class="table table-responsive ">
                <table class="table table-striped table-bordered table-condensed">
                    <thead>
                    <tr>
                        <th><nobr>序号</nobr></th>
                        <th><nobr>项目批次</nobr></th>
                        <th><nobr>立项站点</nobr></th>
                        <th><nobr>项目编码</nobr></th>
                        <th><nobr>施工单位</nobr></th>
                        <th><nobr>送审金额</nobr></th>
                        <th><nobr>审定金额</nobr></th>
                        <th><nobr>合同金额</nobr></th>
                        <th>是否提交<br />纸质资料</th>
                        <th>是否寄送<br />纸质材料</th>
                        <th>是否反馈<br />定案表</th>
                        <th>是否寄送<br />定案表</th>
                        <th style="width:15em">备注</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="projects" id="project">
                        <tr>
                            <td><{$project.id}></td>
                            <td><{$project.month}></td>
                            <td><{$project.site_name}></td>
                            <td><{$project.project_code}></td>
                            <td><{$project.unit}></td>
                            <td><{$project.send_money}></td>
                            <td><{$project.verdict_money}></td>
                            <td><{$project.contract_money}></td>
                            <td>
                                <div class="switch" onColor="info" offColor="active" onText="是" offText="否" data-animated="false">
                                    <input value="1" data-type="is_submit_paper" data-id="<{$project.id}>" type="checkbox" <{$project['is_submit_paper'] == '是' ? 'checked' : ''}> />
                                </div>
                            </td>
                            <td>
                                <div class="switch" onColor="info" offColor="active" onText="是" offText="否" >
                                    <input value="1" data-type="is_send_paper" data-id="<{$project.id}>" type="checkbox" <{$project['is_send_paper'] == '是' ? 'checked' : ''}> />
                                </div>
                            </td>
                            </td>
                            <td>
                                <div class="switch" onColor="info" offColor="active" onText="是" offText="否" >
                                    <input value="1" data-type="is_feedback_verdict" data-id="<{$project.id}>" type="checkbox" <{$project['is_feedback_verdict'] == '是' ? 'checked' : ''}> />
                                </div>
                            </td>
                            <td>
                                <div class="switch" onColor="info" offColor="active" onText="是" offText="否" >
                                    <input value="1" data-type="is_send_verdict" data-id="<{$project.id}>" type="checkbox" <{$project['is_send_verdict'] == '是' ? 'checked' : ''}> />
                                </div>
                            </td>
                            <td>
                                <span><{$project.remark}></span>
                                <input type="text" data-type="remark" name="remark" data-id="<{$project.id}>" class="form-control" value="<{$project.remark}>" style="display:none" />
                            </td>
                            <td class="action-remark">
                                <div class="btn-group btn-group-xs" role="group" aria-label="...">
                                    <button type="button" class="btn btn-default">备注</button>
                                </div>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
            </div>
            <!--分页-->
            <nav>
                <ul class="pagination" id="page" >
                    <li><a href="<{$urls['data']}>&amp;P=1&amp;batch=<{$currentBatch}>">首页</a></li>
                    <php>
                        for($i=1;$i<=$total;$i++){
                            echo '<li><a href="'.U('data', ['P' => $i, 'batch' => $currentBatch]).'">'.$i.'</a></li>';
                        }
                    </php>
                    <li>
                        <a href="javascript:void(0);" aria-label="Next" onclick="more('<{$T}>','<{:U('data', ['batch' => $currentBatch])}>')">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
<include file="./Application/Home/View/Send/footJs.html" />
<script src="__PUBLIC__/public/JS/send.js"></script>
<script src="__PUBLIC__/static/js/ycom.js"></script>

<script>
$(function(){
    $('td input').change(function(event) {
        Ycom.loading.show();
        var value = $(this).attr('type') == 'checkbox' ? $(this).prop('checked') : $(this).val();
        var that = this;
        $.ajax({
            url: '<{:U("changeStuff")}>',
            type: 'POST',
            dataType: 'json',
            data: {
                id: $(this).data('id'),
                type: $(this).data('type'),
                value: value,
            },
        })
        .done(function(result) {
            if (result.code != 'ok') {
                alert(result.msg);
            } else {
                $(that).filter('[type=text]').slideUp();
                $(that).prev().slideDown().text(value);
            }
        })
        .fail(function() {
            alert('网络错误');
        })
        .always(function() {
            Ycom.loading.hide();
        });
    });

    $('.action-remark').click(function(event) {
        $(this).prev().children('span').slideToggle();
        $(this).prev().children('input').slideToggle();
    });
});
</script>
</body>
</html>
